<template>
  <div>

      <h1>病友圈</h1>

      <el-table :data="tableData" style="width: 150%">
          <el-table-column prop="id" label="病友圈主键id" width="180" />
          <el-table-column prop="communicationTitle" label="病友圈标题" width="180" />
          <el-table-column prop="publishUserId" label="发布人id" />
          <el-table-column prop="diseaseTypeName" label="科室名称" />
          <el-table-column prop="diseaseName" label="疾病名称" />
          <el-table-column prop="publishTime" label="发布时间" />
          <el-table-column prop="communicationDetail" label="病症详情" />
          <el-table-column prop="treatHospital" label="医院" />
          <el-table-column prop="treatBeganTime" label="开始时间" />
          <el-table-column prop="treatEndTime" label="结束时间" />
          <el-table-column prop="treatProcess" label="治疗开始时间" />
          <el-table-column prop="communicationImage" label="相关图片" />
          <el-table-column prop="communicationAmount" label="悬赏金额" />
          <el-table-column label="操作" width="150">
              <template #default="scope">
                  <el-button size="small" @click="handleEdit(scope.$index, scope.row)">
                      Edit
                  </el-button>
                  <el-button
                      size="small"
                      type="danger"
                      @click="handleDelete(scope.row.id)"
                  >
                      Delete
                  </el-button>
              </template>
          </el-table-column>
      </el-table>

      <button @click="addillnessfriend">发布病友圈</button>




      <el-dialog v-model="dialogFormVisible" title="新增病友圈信息" width="500">
          <el-form :model="form">
              <el-form-item label="Promotion name">
                  <el-input v-model="form.name" autocomplete="off" />
              </el-form-item>

          </el-form>
          <template #footer>
              <div class="dialog-footer">
                  <el-button @click="dialogFormVisible = false">Cancel</el-button>
                  <el-button type="primary" @click="dialogFormVisible = false">
                      Confirm
                  </el-button>
              </div>
          </template>
      </el-dialog>




  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）,
//例如：import 《组件名称》 from '《组件路径》,
import {LllnessList, ParticularsPODel} from "@/api/patient/illnessfriend.js";

export default {
    //import引入的组件需要注入到对象中才能使用"
    components: {},
    props: {},
    data() {
      //这里存放数据"

      return {

          tableData:[],
          queryParam:{
              pageNum:1,
              pageSize:10
          },
          form:{},
          dialogFormVisible: false,


      };
    },
    //计算属性 类似于data概念",
    computed: {},
    //监控data中的数据变化",
    watch: {},
    //方法集合",
    methods: {


        addillnessfriend(){

            this.dialogFormVisible = true
        },


        getList(){
            LllnessList(this.queryParam).then((res)=>{
                this.tableData = res.data.list
            })
        },

        handleDelete(id){
            ParticularsPODel(id).then(res=>{
                if(res.code == 200){
                    this.$message({
                        type: 'success',
                        message: '删除成功!'
                    });
                    this.getList()
                }
            })
        },

    },
    //生命周期 - 创建完成（可以访问当前this实例）",
    created() {
        this.getList()
    },
    //生命周期 - 挂载完成（可以访问DOM元素）",
    mounted() {
    },
    beforeCreate() {
    }, //生命周期 - 创建之前",
    beforeMount() {
    }, //生命周期 - 挂载之前",
    beforeUpdate() {
    }, //生命周期 - 更新之前",
    updated() {
    }, //生命周期 - 更新之后",
    beforeDestroy() {
    }, //生命周期 - 销毁之前",
    destroyed() {
    }, //生命周期 - 销毁完成",
    activated() {
    } //如果页面有keep-alive缓存功能，这个函数会触发",
  };
</script>
<style scoped>

</style>
